<template>
  <div class="combined-number-card">
    <div class="combined-number-card-left">
      <div class="number-display">{{ formattedLeftNumber }}</div>
      <div class="card-title">{{ leftTitle }}</div>
    </div>
    <div class="combined-number-card-right">
      <div class="number-display">{{ formattedRightNumber }}</div>
      <div class="card-title">{{ rightTitle }}</div>
    </div>
    <div class="card-glow"></div>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'

interface Props {
  leftNumber?: number
  leftTitle?: string
  rightNumber?: number
  rightTitle?: string
  color?: string
}

const props = withDefaults(defineProps<Props>(), {
  leftNumber: 0,
  leftTitle: '2018年总收入情况',
  rightNumber: 0,
  rightTitle: '2018年总支出情况',
  color: '#ffff00'
})

// 格式化数字，添加分隔符
const formattedLeftNumber = computed(() => {
  const num = props.leftNumber ?? 0
  return num.toLocaleString()
})

const formattedRightNumber = computed(() => {
  const num = props.rightNumber ?? 0
  return num.toLocaleString()
})
</script>

<style scoped>
@font-face {
  font-family: "PUTHIAfont";
  src: url("../../font/PUTHIAfont.TTF");
}

.combined-number-card {
  position: relative;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(32, 49, 232, 0.889);
  border-radius: 8px;
  padding: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  gap: 20px;
}

.combined-number-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(255, 255, 0, 0.3);
}

.combined-number-card-left,
.combined-number-card-right {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 2;
}

.combined-number-card-left {
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  padding-right: 20px;
}

.combined-number-card-right {
  padding-left: 20px;
}

.number-display {
  font-family: "PUTHIAfont", 'Courier New', 'Monaco', 'Menlo', monospace;
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 8px;
  letter-spacing: 2px;
  animation: numberGlow 2s ease-in-out infinite alternate,
             numberPulse 1s ease-in-out infinite;
}

.combined-number-card-left .number-display {
  color: #cece5c;
 
}

.combined-number-card-right .number-display {
  color: #cece5c;
 
}

.card-title {
  font-size: 16px;
  color: #fff;
  font-weight: 500;
  opacity: 0.9;
}

.card-glow {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    transparent, 
    rgba(255, 255, 0, 0.1), 
    transparent, 
    rgba(0, 255, 255, 0.1), 
    transparent);
  border-radius: 8px;
  z-index: 1;
  animation: borderGlow 3s linear infinite;
}

@keyframes numberGlow {
  0% {
    filter: brightness(1);
  }
  100% {
    filter: brightness(1.2);
  }
}

@keyframes borderGlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes numberPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .combined-number-card {
    flex-direction: column;
    gap: 10px;
  }
  
  .combined-number-card-left {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 0;
    padding-bottom: 10px;
  }
  
  .combined-number-card-right {
    padding-left: 0;
    padding-top: 10px;
  }
  
  .number-display {
    font-size: 36px;
  }
  
  .card-title {
    font-size: 14px;
  }
  
  .combined-number-card {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .number-display {
    font-size: 28px;
  }
  
  .card-title {
    font-size: 12px;
  }
  
  .combined-number-card {
    padding: 12px;
  }
}
</style>